﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.DialogUI {
    import flash.events.*;
    import flash.display.*;
    import flash.utils.*;
    import flash.text.*;
    import Display.aswingui.*;
    import Engine.*;

    public class InputTextDialog extends GenericDialog {

        protected var m_inputLabel:String;
        protected var m_inputField:String;
        protected var m_maxLength:int;
        protected var m_textField:TextField;

        public function InputTextDialog(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:int=0, _arg6:int=0, _arg7:Function=null, _arg8:Boolean=true, _arg9:Function=null){
            if (Utilities.isFullScreen()){
                Utilities.toggleFullScreen();
            };
            this.m_inputLabel = _arg3;
            this.m_inputField = _arg4;
            this.m_maxLength = _arg5;
            super(_arg1, _arg2, _arg6, _arg7, _arg2, "", _arg8, 0, "", _arg9);
            this.addEventListener(Event.ADDED_TO_STAGE, this.setFocus, false, 0, true);
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Dictionary = new Dictionary();
            _local1["dialog_bg"] = (new m_comObject.dialog_name_city() as DisplayObject);
            return (_local1);
        }
        public function get textField():TextField{
            return (this.m_textField);
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            var _local2:InputTextDialogView = new InputTextDialogView(_arg1, m_message, m_title, this.m_inputLabel, this.m_inputField, m_type, m_callback, "", 0, m_SkipCallback);
            this.m_textField = _local2.textField;
            return (_local2);
        }
        override protected function onAssetsLoaded(_arg1:Event=null):void{
            var _local2:Dictionary = this.createAssetDict();
            m_jpanel = this.createDialogView(_local2);
            this.addEventListener(Event.ADDED_TO_STAGE, this.setFocus, false, 0, true);
            finalizeAndShow();
        }
        protected function setFocus(_arg1:Event):void{
            m_jwindow.removeEventListener(Event.ADDED_TO_STAGE, this.setFocus);
            var _local2:InputTextDialogView = (m_jpanel as InputTextDialogView);
            var _local3:TextField = _local2.textField;
            _local3.maxChars = this.m_maxLength;
            Global.stage.focus = _local3;
            setTimeout(_local3.setSelection, 250, 0, _local3.text.length);
            ASwingHelper.prepare(m_jwindow);
        }

    }
}//package Display.DialogUI 
